package kokonut.admin;

import java.io.IOException;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import persistence.ProductPersistence;

public class EraseProductServlet extends HttpServlet {
    @Override
	public void doGet(HttpServletRequest req, HttpServletResponse resp)
              throws IOException {
    	int ref = Integer.parseInt(req.getParameter("ref"));

    	ProductPersistence persistence = new ProductPersistence();
    	persistence.deleteProductByRef(ref);
    	persistence.closePM();
    	resp.sendRedirect("/admin/shopAdmin");
    }
}